package client_package;

import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.WindowEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class VueMenu extends VueAvecBar {
	private static final long serialVersionUID = 1L;
	
	private JPanel contentPane;
	private JButton btnConnexion;
	private JButton btnQuitter;
	private JButton btnSenregistrer;
	
	

	public VueMenu(Controleur c) {
		super(c);
		setResizable(false);
		setBounds(100, 100, 300, 300);
		setTitle("Menu client");
		
		this.addWindowListener (new WindowAdapter() {
			public void windowClosing (WindowEvent e) {
			getControleur().fermerVue(VueMenu.this);
			}
		});
		
		JMenuItem mntmConnexion = new JMenuItem("Connexion");
		getMnApplication().add(mntmConnexion, 0);
		mntmConnexion.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().vueConnexion();
			}
		});
		
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		btnConnexion = new JButton("Connexion");
		btnConnexion.setBounds(86, 44, 120, 25);
		contentPane.add(btnConnexion);
		btnConnexion.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().vueConnexion();
			}
		});
		
		btnQuitter = new JButton("Quitter");
		btnQuitter.setBounds(86, 182, 120, 25);
		contentPane.add(btnQuitter);
		btnQuitter.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				getControleur().fermerVue(VueMenu.this);
			}
		});
		
		btnSenregistrer = new JButton("S'enregistrer");
		btnSenregistrer.setBounds(86, 113, 120, 25);
		contentPane.add(btnSenregistrer);
		btnSenregistrer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				 getControleur().VueInscription();
			}
		});
	}
}
